home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus Special 25
/
AMIGAplus Sonderheft 25 (2000)(Falke)(DE)(Track 1 of 4)[!].iso
/
PublicDomain
/
Anwendungen
/
FloatingClock
/
Source
/
digits.c
next >
Wrap
C/C++ Source or Header
|
1998-06-16
|
6KB
|
172 lines
/***********************
* *
* Digits for Fclock. *
* *
***********************/
#include <exec/types.h>
#include <clib/exec_protos.h>
#include <clib/intuition_protos.h>
#include "digits.h"
/**************************************************/
/* Arrays of co-ordinates, and border definitions */
/* to render the seven segment display digits. */
/**************************************************/
/* Co-Ords for the horizontal segment */
/* border and filler lines! */
SHORT lthor_segment[]={ 0, 2, 2, 0, 10, 0, 11, 1 };
SHORT dkhor_segment[]={ 1, 3, 2, 4, 10, 4, 12, 2 };
SHORT hfiller[]={ 2, 1, 10, 1, 11, 2, 1, 2, 2, 3, 10, 3 };
struct Border hor_border_seg=
{ 0, 0, 1, 0, JAM1, 4, dkhor_segment, NULL };
struct Border hor_border2=
{ 0, 0, 2, 0, JAM1, 4, lthor_segment, &hor_border_seg };
struct Border hfiller_border=
{ 0, 0, 8, 0, JAM1, 6, hfiller, &hor_border2 };
/* Co-Ords for the vertical segment */
/* border and filler lines! */
SHORT ltver_segment[]={ 0, 10, 0, 2, 2, 0, 3, 1 };
SHORT dkver_segment[]={ 4, 2, 4, 10, 2, 12, 1, 11 };
SHORT vfiller[]={ 1, 2, 1, 10, 2, 11, 2, 1, 3, 2, 3, 10 };
struct Border ver_border_seg=
{ 0, 0, 1, 0, JAM1, 4, dkver_segment, NULL };
struct Border ver_border2=
{ 0, 0, 2, 0, JAM1, 4, ltver_segment, &ver_border_seg };
struct Border vfiller_border=
{ 0, 0, 8, 0, JAM1, 6, vfiller, &ver_border2 };
/* Co-Ords for the deviding dots */
/* border and filler lines! */
SHORT ltdots[]={ 2, 0, 1, 0, 0, 1, 0, 2 };
SHORT dkdots[]={ 1, 3, 2, 3, 3, 2, 3, 1 };
SHORT dfiller[]={ 1, 1, 2, 1, 2, 2, 1, 2 };
struct Border dots_border=
{ 0, 0, 2, 0, JAM1, 4, ltdots, NULL };
struct Border dots2=
{ 0, 0, 1, 0, JAM1, 4, dkdots, &dots_border };
struct Border dfiller_border=
{ 0, 0, 8, 0, JAM1, 4, dfiller, &dots2 };
/* Prototype decs..
void number_one(int, struct Window *);
void number_two(int, struct Window *);
void number_three(int, struct Window *);
void number_four(int, struct Window *);
void number_five(int, struct Window *);
void number_six(int, struct Window *);
void number_seven(int, struct Window *);
void number_eight(int, struct Window *);
void number_nine(int, struct Window *);
void number_zero(int, struct Window *);
void dots(struct Window *);
*/
/****************************************
* *
* Definitions for the different numbers*
* made by the segments... *
* *
* Note: top_hor = x+3 and Y *
* mid_hor = x+3 and Y+14 *
* bot_hor = X+3 and Y+28 *
* top_ver = Y+3 (x+14 for RHS) *
* bot_ver = Y+17 *
****************************************/
void number_one(int xoffset, struct Window *win)
{
DrawBorder( win->RPort, &vfiller_border, xoffset+14, Y+3 );
DrawBorder( win->RPort, &vfiller_border, xoffset+14, Y+17 );
}
void number_two(int xoffset, struct Window *win)
{
DrawBorder( win->RPort, &hfiller_border, xoffset+3, Y );
DrawBorder( win->RPort, &vfiller_border, xoffset+14, Y+3 );
DrawBorder( win->RPort, &hfiller_border, xoffset+3, Y+14 );
DrawBorder( win->RPort, &vfiller_border, xoffset, Y+17 );
DrawBorder( win->RPort, &hfiller_border, xoffset+3, Y+28 );
}
void number_three(int xoffset, struct Window *win)
{
DrawBorder( win->RPort, &hfiller_border, xoffset+3, Y );
DrawBorder( win->RPort, &vfiller_border, xoffset+14,Y+3 );
DrawBorder( win->RPort, &hfiller_border, xoffset+3, Y+14 );
DrawBorder( win->RPort, &vfiller_border, xoffset+14,Y+17 );
DrawBorder( win->RPort, &hfiller_border, xoffset+3, Y+28 );
}
void number_four(int xoffset, struct Window *win)
{
DrawBorder( win->RPort, &vfiller_border, xoffset, Y+3 );
DrawBorder( win->RPort, &vfiller_border, xoffset+14,Y+3 );
DrawBorder( win->RPort, &hfiller_border, xoffset+3, Y+14 );
DrawBorder( win->RPort, &vfiller_border, xoffset+14,Y+17 );
}
void number_five(int xoffset, struct Window *win)
{
DrawBorder( win->RPort, &hfiller_border, xoffset+3, Y );
DrawBorder( win->RPort, &vfiller_border, xoffset, Y+3 );
DrawBorder( win->RPort, &hfiller_border, xoffset+3, Y+14 );
DrawBorder( win->RPort, &vfiller_border, xoffset+14,Y+17 );
DrawBorder( win->RPort, &hfiller_border, xoffset+3, Y+28 );
}
void number_six(int xoffset, struct Window *win)
{
DrawBorder( win->RPort, &hfiller_border, xoffset+3, Y );
DrawBorder( win->RPort, &vfiller_border, xoffset, Y+3 );
DrawBorder( win->RPort, &hfiller_border, xoffset+3, Y+14 );
DrawBorder( win->RPort, &vfiller_border, xoffset, Y+17 );
DrawBorder( win->RPort, &vfiller_border, xoffset+14,Y+17 );
DrawBorder( win->RPort, &hfiller_border, xoffset+3, Y+28 );
}
void number_seven(int xoffset, struct Window *win)
{
DrawBorder( win->RPort, &hfiller_border, xoffset+3, Y );
DrawBorder( win->RPort, &vfiller_border, xoffset+14,Y+3 );
DrawBorder( win->RPort, &vfiller_border, xoffset+14,Y+17 );
}
void number_eight(int xoffset, struct Window *win)
{
DrawBorder( win->RPort, &hfiller_border, xoffset+3, Y );
DrawBorder( win->RPort, &vfiller_border, xoffset, Y+3 );
DrawBorder( win->RPort, &vfiller_border, xoffset+14,Y+3 );
DrawBorder( win->RPort, &hfiller_border, xoffset+3, Y+14 );
DrawBorder( win->RPort, &vfiller_border, xoffset, Y+17 );
DrawBorder( win->RPort, &vfiller_border, xoffset+14,Y+17 );
DrawBorder( win->RPort, &hfiller_border, xoffset+3, Y+28 );
}
void number_nine(int xoffset, struct Window *win)
{
DrawBorder( win->RPort, &hfiller_border, xoffset+3, Y );
DrawBorder( win->RPort, &vfiller_border, xoffset, Y+3 );
DrawBorder( win->RPort, &vfiller_border, xoffset+14,Y+3 );
DrawBorder( win->RPort, &hfiller_border, xoffset+3, Y+14 );
DrawBorder( win->RPort, &vfiller_border, xoffset+14,Y+17 );
DrawBorder( win->RPort, &hfiller_border, xoffset+3, Y+28 );
}
void number_zero(int xoffset, struct Window *win)
{
DrawBorder( win->RPort, &hfiller_border, xoffset+3, Y );
DrawBorder( win->RPort, &vfiller_border, xoffset, Y+3 );
DrawBorder( win->RPort, &vfiller_border, xoffset+14,Y+3 );
DrawBorder( win->RPort, &vfiller_border, xoffset, Y+17 );
DrawBorder( win->RPort, &vfiller_border, xoffset+14,Y+17 );
DrawBorder( win->RPort, &hfiller_border, xoffset+3, Y+28 );
}
void dots(struct Window *win)
{
DrawBorder( win->RPort, &dfiller_border, DOTX, DOTY );
DrawBorder( win->RPort, &dfiller_border, DOTX, DOTY+10 );
}